﻿//-------------------------------------------------------------------
//版权所有：版权所有(C) 2010， YIBO(China) Studio 
//系统名称：验证控件
//文件名称：InputStringClientValidator.cs
//模块名称：验证控件
//模块编号：
//作　　者：LHC
//完成日期：2010/8/29 14:34:00
//功能说明：
//-----------------------------------------------------------------
//修改记录：
//修改人：  
//修改时间：
//修改内容：
//-------------------------------------------------------------------
#region 程序集 YIBO.Validator, v1.0.100829

using System.ComponentModel;

#endregion

namespace MvcMall.Framework.FormValidator
{
    /// <summary>
    /// 验证类
    /// </summary>
    [TypeConverter(typeof(ExpandableObjectConverter))]
    public abstract class ClientValidator
    {
        /// <summary>
        /// 错误信息
        /// </summary>
        private string errorMessage;
        /// <summary>
        ///验证标签 
        /// </summary>
        private ValidateTarget owner;

        /// <summary>
        /// 默认构造函数
        /// </summary>
        protected ClientValidator()
        {
        }

        /// <summary>
        /// 创建验证容器
        /// </summary>
        /// <returns>返回控件容器</returns>
        internal abstract ValidateRenderControl GenerateAppendScript();
        /// <summary>
        /// 注册验证规则
        /// </summary>
        /// <returns>返回输出容器</returns>
        internal abstract ValidateRenderControl GenerateInitScript();

        /// <summary>
        /// 初始化验证控件对象
        /// </summary>
        /// <param name="owner">控件类型对象</param>
        internal void SetOwner(ValidateTarget owner)
        {
            this.owner = owner;
        }

        /// <summary>
        /// 错误信息
        /// </summary>
        public virtual string ErrorMessage
        {
            get
            {
                return this.errorMessage;
            }
            set
            {
                this.errorMessage = value;
            }
        }

        /// <summary>
        /// 获取当前标签对象
        /// </summary>
        protected ValidateTarget Owner
        {
            get
            {
                return this.owner;
            }
        }
    }
}


